package cate.game.play.skill.passive.fairy;

import cate.common.table.d.GDAttr;
import cate.common.table.d.GDSkill;
import cate.game.play.base.TargetFilterParam;
import cate.game.play.base.TargetSelector;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 奇数回合为我方血量最低的单位附加【羽芒】，受到治疗增加15%，抗控提升30%，且自身增益状态无法被驱散
 */
public class 卡布奇诺灵器PH extends PassiveHandler {

	private int 羽芒buff;

	//羽芒buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		羽芒buff = args.getInt("羽芒buff", 0);
	}

	@Override
	public void onRoundBegin(ActionCtx action) {
		if (action.getRound().isEvenRound()) {
			return;
		}
		if (skill.owner.isDead()) {
			return;
		}
		TargetFilterParam param = new TargetFilterParam().scopeSet(GDSkill.Scope.WE).smallAttrSet(GDAttr.V_HP_LEFT_RATE);
		Fighter one = TargetSelector.findOne(skill.owner, action.getTeamVs(), param);
		if (one != null) {
			one.buff.tryAddByTid(action, skill.owner, 羽芒buff);
		}
	}
}
